#ifndef MDTX_USE_RCPPARMADILLO
#define MDTX_USE_RCPPARMADILLO
#endif

#include <RcppArmadillo.h>
using namespace Rcpp;

#include "mdtx-online/indicator/indicator_type_ma.h"
#include "mdtx-online/indicator/indicator_type_ma_rsi.h"
using namespace mdtx::online;

#include "indi_common.h"

using rsi_ = indi1<indicator::rsi>;

//' Relative strength index
//'
//' @param x Numeric vector
//' @param period Period of rolling window
//' @return Numeric vector
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi(NumericVector x, int period)
{
    auto c = rsi_::create_t(period);
    return rsi_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_new(int period)
{
    return rsi_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_run(SEXP ptr, NumericVector x)
{
    return rsi_::run(ptr, x);
}

using tsi_ = indi1<indicator::tsi>;

//' True strength index
//'
//' @param x Numeric vector
//' @param period Period of rolling window
//' @return Numeric vector
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector tsi(NumericVector x, int period)
{
    auto c = tsi_::create_t(period);
    return tsi_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP tsi_new(int period)
{
    return tsi_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector tsi_run(SEXP ptr, NumericVector x)
{
    return tsi_::run(ptr, x);
}

using rsi_ema_ = indi1<indicator::rsi_ma<indicator::ema>>;

//' RSI of MA
//'
//' @param x Numeric vector
//' @param period Period of rolling window
//' @return Numeric vector
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_ema(NumericVector x, int period)
{
    auto c = rsi_ema_::create_t(period);
    return rsi_ema_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_ema_new(int period)
{
    return rsi_ema_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_ema_run(SEXP ptr, NumericVector x)
{
    return rsi_ema_::run(ptr, x);
}

using rsi_dema_ = indi1<indicator::rsi_ma<indicator::dema>>;

//' @rdname rsi_ema
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_dema(NumericVector x, int period)
{
    auto c = rsi_dema_::create_t(period);
    return rsi_dema_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_dema_new(int period)
{
    return rsi_dema_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_dema_run(SEXP ptr, NumericVector x)
{
    return rsi_dema_::run(ptr, x);
}

using rsi_tema_ = indi1<indicator::rsi_ma<indicator::tema>>;

//' @rdname rsi_ema
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_tema(NumericVector x, int period)
{
    auto c = rsi_tema_::create_t(period);
    return rsi_tema_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_tema_new(int period)
{
    return rsi_tema_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_tema_run(SEXP ptr, NumericVector x)
{
    return rsi_tema_::run(ptr, x);
}

using rsi_t3ma_ = indi1<indicator::rsi_ma<indicator::t3ma>>;

//' @rdname rsi_ema
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_t3ma(NumericVector x, int period)
{
    auto c = rsi_t3ma_::create_t(period);
    return rsi_t3ma_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_t3ma_new(int period)
{
    return rsi_t3ma_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_t3ma_run(SEXP ptr, NumericVector x)
{
    return rsi_t3ma_::run(ptr, x);
}

using rsi_ewma_ = indi1<indicator::rsi_ma<indicator::ewma>>;

//' @rdname rsi_ema
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_ewma(NumericVector x, int period)
{
    auto c = rsi_ewma_::create_t(period);
    return rsi_ewma_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_ewma_new(int period)
{
    auto ptr = rsi_ewma_::create(period);
    return ptr;
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_ewma_run(SEXP ptr, NumericVector x)
{
    return rsi_ewma_::run(ptr, x);
}

using rsi_zlema_ = indi1<indicator::rsi_ma<indicator::zlema>>;

//' @rdname rsi_ema
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_zlema(NumericVector x, int period)
{
    auto c = rsi_zlema_::create_t(period);
    return rsi_zlema_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_zlema_new(int period)
{
    return rsi_zlema_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_zlema_run(SEXP ptr, NumericVector x)
{
    return rsi_zlema_::run(ptr, x);
}

using rsi_tma_ = indi1<indicator::rsi_ma<indicator::tma>>;

//' @rdname rsi_ema
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_tma(NumericVector x, int period)
{
    auto c = rsi_tma_::create_t(period);
    return rsi_tma_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_tma_new(int period)
{
    return rsi_tma_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_tma_run(SEXP ptr, NumericVector x)
{
    return rsi_tma_::run(ptr, x);
}

using rsi_wma_ = indi1<indicator::rsi_ma<indicator::wma>>;

//' @rdname rsi_ema
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_wma(NumericVector x, int period)
{
    auto c = rsi_wma_::create_t(period);
    return rsi_wma_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_wma_new(int period)
{
    return rsi_wma_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_wma_run(SEXP ptr, NumericVector x)
{
    return rsi_wma_::run(ptr, x);
}

using rsi_hma_ = indi1<indicator::rsi_ma<indicator::hma>>;

//' @rdname rsi_ema
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_hma(NumericVector x, int period)
{
    auto c = rsi_hma_::create_t(period);
    return rsi_hma_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_hma_new(int period)
{
    return rsi_hma_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_hma_run(SEXP ptr, NumericVector x)
{
    return rsi_hma_::run(ptr, x);
}

using rsi_vwma_ = indi1<indicator::rsi_wma<indicator::vwma>>;

//' RSI of volume weighted MA
//'
//' @param price Numeric vector price
//' @param volume Numeric vector volume
//' @param period Period of rolling window
//' @return Numeric vector
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_vwma(NumericVector price, NumericVector volume, int period)
{
    if (price.length() != volume.length())
    {
        stop("Input lengths do not match.");
    }
    auto c = rsi_vwma_::create_t(period);
    return rsi_vwma_::run_t(c, price, volume);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_vwma_new(int period)
{
    return rsi_vwma_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_vwma_run(SEXP ptr, NumericVector price, NumericVector volume)
{
    return rsi_vwma_::run(ptr, price, volume);
}

using rsi_evwma_ = indi1<indicator::rsi_wma<indicator::evwma>>;

//' @rdname rsi_vwma
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_evwma(NumericVector price, NumericVector volume, int period)
{
    if (price.length() != volume.length())
    {
        stop("Input lengths do not match.");
    }
    auto c = rsi_evwma_::create_t(period);
    return rsi_evwma_::run_t(c, price, volume);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_evwma_new(int period)
{
    return rsi_evwma_::create(period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_evwma_run(SEXP ptr, NumericVector price, NumericVector volume)
{
    return rsi_evwma_::run(ptr, price, volume);
}

using rsi_emosc_ = indi1<indicator::rsi_maosc<indicator::ema>>;

//' RSI of MA OSC
//'
//' @param x Numeric vector
//' @param fast_period fast moving window period
//' @param slow_period slow moving window period
//' @param signal_period signal moving window period
//' @return Numeric vector
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_emosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_emosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_emosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_emosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_emosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_emosc_run(SEXP ptr, NumericVector x)
{
    return rsi_emosc_::run(ptr, x);
}

using rsi_demosc_ = indi1<indicator::rsi_maosc<indicator::dema>>;

//' @rdname rsi_emosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_demosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_demosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_demosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_demosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_demosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_demosc_run(SEXP ptr, NumericVector x)
{
    return rsi_demosc_::run(ptr, x);
}

using rsi_temosc_ = indi1<indicator::rsi_maosc<indicator::tema>>;

//' @rdname rsi_emosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_temosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_temosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_temosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_temosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_temosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_temosc_run(SEXP ptr, NumericVector x)
{
    return rsi_temosc_::run(ptr, x);
}

using rsi_t3mosc_ = indi1<indicator::rsi_maosc<indicator::t3ma>>;

//' @rdname rsi_emosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_t3mosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_t3mosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_t3mosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_t3mosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_t3mosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_t3mosc_run(SEXP ptr, NumericVector x)
{
    return rsi_t3mosc_::run(ptr, x);
}

using rsi_ewmosc_ = indi1<indicator::rsi_maosc<indicator::ewma>>;

//' @rdname rsi_emosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_ewmosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_ewmosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_ewmosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_ewmosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_ewmosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_ewmosc_run(SEXP ptr, NumericVector x)
{
    return rsi_ewmosc_::run(ptr, x);
}

using rsi_zlemosc_ = indi1<indicator::rsi_maosc<indicator::zlema>>;

//' @rdname rsi_emosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_zlemosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_zlemosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_zlemosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_zlemosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_zlemosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_zlemosc_run(SEXP ptr, NumericVector x)
{
    return rsi_zlemosc_::run(ptr, x);
}

using rsi_tmosc_ = indi1<indicator::rsi_maosc<indicator::tma>>;

//' @rdname rsi_emosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_tmosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_tmosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_tmosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_tmosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_tmosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_tmosc_run(SEXP ptr, NumericVector x)
{
    return rsi_tmosc_::run(ptr, x);
}

using rsi_wmosc_ = indi1<indicator::rsi_maosc<indicator::wma>>;

//' @rdname rsi_emosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_wmosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_wmosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_wmosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_wmosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_wmosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_wmosc_run(SEXP ptr, NumericVector x)
{
    return rsi_wmosc_::run(ptr, x);
}

using rsi_hmosc_ = indi1<indicator::rsi_maosc<indicator::hma>>;

//' @rdname rsi_emosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_hmosc(NumericVector x, int fast_period, int slow_period, int signal_period)
{
    auto c = rsi_hmosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_hmosc_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_hmosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_hmosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_hmosc_run(SEXP ptr, NumericVector x)
{
    return rsi_hmosc_::run(ptr, x);
}

using rsi_vwmosc_ = indi1<indicator::rsi_wmaosc<indicator::vwma>>;

//' RSI of volume weighted MA OSC
//'
//' @param price Numeric vector price
//' @param volume Numeric vector volume
//' @param fast_period fast moving window period
//' @param slow_period slow moving window period
//' @param signal_period signal moving window period//' @return Numeric vector
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_vwmosc(NumericVector price, NumericVector volume, int fast_period, int slow_period, int signal_period)
{
    if (price.length() != volume.length())
    {
        stop("Input lengths do not match.");
    }
    auto c = rsi_vwmosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_vwmosc_::run_t(c, price, volume);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_vwmosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_vwmosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_vwmosc_run(SEXP ptr, NumericVector price, NumericVector volume)
{
    return rsi_vwmosc_::run(ptr, price, volume);
}

using rsi_evwmosc_ = indi1<indicator::rsi_wmaosc<indicator::evwma>>;

//' @rdname rsi_vwmosc
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector rsi_evwmosc(NumericVector price, NumericVector volume, int fast_period, int slow_period, int signal_period)
{
    if (price.length() != volume.length())
    {
        stop("Input lengths do not match.");
    }
    auto c = rsi_evwmosc_::create_t(fast_period, slow_period, signal_period);
    return rsi_evwmosc_::run_t(c, price, volume);
}

// [[Rcpp::export(rng = false)]]
SEXP rsi_evwmosc_new(int fast_period, int slow_period, int signal_period)
{
    return rsi_evwmosc_::create(fast_period, slow_period, signal_period);
}

// [[Rcpp::export(rng = false)]]
NumericVector rsi_evwmosc_run(SEXP ptr, NumericVector price, NumericVector volume)
{
    return rsi_evwmosc_::run(ptr, price, volume);
}
